package a.f.c;

import a.c.*;
import a.c.d;
import a.c.e;
import a.c.k;
import a.f.o;
import a.i.p;

import java.util.HashMap;
import java.util.HashSet;

public class h
  implements i
{
  private a.c.q f;
  private x g;
  private a_ h;
  public static boolean i;
  public static boolean j;
  
  public h(a.c.q paramq)
  {
    this.f = paramq;
    a();
  }
  
  protected void a()
  {
    boolean bool2 = j;
    boolean bool1 = i;
    Object localObject1 = this.f.c(i.a);
    if (!bool2) {
      if (localObject1 == null) {
        localObject1 = new p()
        {
          public Object get(Object paramAnonymousObject)
          {
            return paramAnonymousObject;
          }
        };
      }
    }
    k localk1 = this.f.c(i.b);
    if (!bool2) {
      if (localk1 == null) {
        localk1 = a.i.q.a(null);
      }
    }
    k localk2 = this.f.c(i.c);
    if (!bool2)
    {
      if (localk2 == null) {
        localk2 = a.i.q.a(Boolean.FALSE);
      }
      this.g = a(this.f);
      this.h = new a_(null, new bb());
    }
    HashMap localHashMap = new HashMap();
    w localw = this.f.v();
    e locale;
    Object localObject2;
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        locale = localw.d();
        localObject2 = ((k)localObject1).get(locale);
        if (bool1) {
          break label279;
        }
        if (localObject2 == null) {
          throw new IllegalArgumentException("no id defined for node " + locale);
        }
        localHashMap.put(localObject2, locale);
        localw.f();
      } while (!bool1);
    } while (bool2);
    localw = this.f.v();
    label279:
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      localObject2 = (e)localHashMap.get(localk1.get(locale));
      a_ locala_1 = a(locale);
      a_ locala_2 = a((e)localObject2);
      a(locala_2, locale);
      locala_1.a = ((e)localObject2);
      if ((!bool2) && (bool1)) {
        return;
      }
      if (!bool2)
      {
        if ((localk2.getBool(locale)) && ((bool2) || (locala_1.b == null))) {
          locala_1.b = new bb();
        }
        localw.f();
      }
    } while (!bool1);
    if (!bool2) {
      a(d(), this.h);
    }
  }
  
  private void a(e parame, a_ parama_)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    if (parama_.b == null) {
      return;
    }
    HashMap localHashMap1 = new HashMap();
    HashMap localHashMap2 = new HashMap();
    ab localab1 = new ab();
    ab localab2 = new ab();
    v localv1 = parama_.b.f();
    e locale;
    Object localObject;
    label91:
    do
    {
      do
      {
        if (localv1 == null) {
          break;
        }
        locale = (e)localv1.c();
        if (bool1) {
          break label290;
        }
        localObject = locale.i();
        if (localObject != null) {}
        do
        {
          do
          {
            if (bool1) {
              break label178;
            }
            if (b(((d)localObject).e()) != parame) {
              localHashMap2.put(localObject, localab2.b(localObject));
            }
            localObject = ((d)localObject).j();
            if (!bool1) {
              break;
            }
            if (bool2) {
              break label91;
            }
            localObject = locale.h();
            if (localObject == null) {
              break label209;
            }
          } while (bool2);
        } while (bool1);
        if (b(((d)localObject).f()) != parame) {}
        while (bool2)
        {
          localHashMap1.put(localObject, localab1.b(localObject));
          localObject = ((d)localObject).i();
          if (!bool1) {
            break;
          }
        }
        localObject = (a_)this.g.get(locale);
        a(locale, (a_)localObject);
        localv1 = localv1.a();
      } while (!bool1);
    } while (bool2);
    label178:
    label209:
    localv1 = parama_.b.f();
    label290:
    label420:
    label436:
    do
    {
      if (localv1 == null) {
        break;
      }
      locale = (e)localv1.c();
      localObject = (a_)this.g.get(locale);
      if (bool2) {
        return;
      }
      if (bool1) {
        break label566;
      }
      if ((bool2) || (((a_)localObject).d != null))
      {
        v localv2 = ((a_)localObject).d.f();
        if (localv2 != null) {}
        d locald;
        v localv3;
        while (bool2)
        {
          locald = (d)localv2.c();
          localv3 = (v)localHashMap2.get(locald);
          if (bool1) {
            break label436;
          }
          if (localv3 != null)
          {
            localab2.h(localv3);
            localHashMap2.remove(locald);
            if (bool2) {
              break label420;
            }
            if (!bool1) {}
          }
          else
          {
            localHashMap1.put(locald, localab1.b(locald));
          }
          localv2 = localv2.a();
          if (!bool1) {
            break;
          }
        }
        localv2 = ((a_)localObject).c.f();
        do
        {
          if (localv2 == null) {
            break;
          }
          locald = (d)localv2.c();
          localv3 = (v)localHashMap1.get(locald);
          if (bool2) {
            break label549;
          }
          if (bool1) {
            break label547;
          }
          if (localv3 != null)
          {
            localab1.h(localv3);
            localHashMap1.remove(locald);
            if (bool2) {
              continue;
            }
            if (!bool1) {}
          }
          else
          {
            localHashMap2.put(locald, localab2.b(locald));
          }
          localv2 = localv2.a();
        } while (!bool1);
      }
      if (!bool2) {}
      localv1 = localv1.a();
    } while (!bool1);
    label547:
    label549:
    parama_.c = localab2;
    if (!bool2) {
      label566:
      parama_.d = localab1;
    }
  }
  
  public o b()
  {
    return (o)this.f;
  }
  
  public a.c.q c()
  {
    return this.f;
  }
  
  private void a(a_ parama_, e parame)
  {
    if (!j) {
      if (parama_.b == null) {
        parama_.b = new bb();
      }
    }
    parama_.b.add(parame);
  }
  
  private a_ a(e parame)
  {
    boolean bool = j;
    if (!bool) {
      if (parame == null) {
        return this.h;
      }
    }
    a_ locala_ = (a_)this.g.get(parame);
    if (!bool) {
      if (locala_ == null)
      {
        locala_ = new a_(null, null);
        this.g.a(parame, locala_);
      }
    }
    return locala_;
  }
  
  protected x a(a.c.q paramq)
  {
    return paramq.B();
  }
  
  protected void a(a.c.q paramq, x paramx)
  {
    if ((paramq != null) && (paramx != null)) {
      paramq.a(paramx);
    }
  }
  
  public e b(e parame)
  {
    if (!j) {
      if (parame == null) {
        throw new IllegalArgumentException("node is root!");
      }
    }
    return ((a_)this.g.get(parame)).a;
  }
  
  public e d()
  {
    return null;
  }
  
  public bb c(e parame)
  {
    if (!j) {}
    return parame == null ? this.h.b : ((a_)this.g.get(parame)).b;
  }
  
  public bb d(e parame)
  {
    bb localbb = new bb();
    a(parame, localbb);
    return localbb;
  }
  
  private void a(e parame, bb parambb)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    if (!bool2) {}
    a_ locala_ = parame == null ? this.h : (a_)this.g.get(parame);
    v localv = locala_.b.f();
    do
    {
      if (localv == null) {
        break;
      }
      e locale = (e)localv.c();
      parambb.add(locale);
      if (!bool2)
      {
        if (e(locale)) {
          a(locale, parambb);
        }
        localv = localv.a();
      }
    } while (!bool1);
  }
  
  public boolean e(e parame)
  {
    return ((!j) && (parame == null)) || (((a_)this.g.get(parame)).b != null);
  }
  
  public boolean f(e parame)
  {
    boolean bool = j;
    if ((bool) || (e(parame))) {
      if (bool) {}
    }
    return !c(parame).isEmpty();
  }
  
  public boolean a(d paramd)
  {
    return b(paramd.e()) == b(paramd.f());
  }
  
  public ab g(e parame)
  {
    return a(parame).c;
  }
  
  public ab h(e parame)
  {
    return a(parame).d;
  }
  
  public e a(e parame1, e parame2)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    if (!bool2) {
      if (parame1 == null) {
        throw new IllegalArgumentException("no representative for virtual root!");
      }
    }
    e locale = b(parame1);
    do
    {
      if (locale == parame2) {
        break;
      }
      if (bool1) {
        break label68;
      }
      if (locale == null) {
        break;
      }
      parame1 = locale;
      locale = b(parame1);
    } while (!bool1);
    if ((!bool2) && (locale == null))
    {
      label68:
      if (bool2) {
        break label83;
      }
      if (parame2 != null) {
        return null;
      }
    }
    label83:
    return parame1;
  }
  
  public void e()
  {
    a(this.f, this.g);
    this.f = null;
    this.g = null;
    this.h = null;
  }
  
  public static boolean b(a.c.q paramq)
  {
    boolean bool = j;
    return ((bool) || (paramq.c(i.c) != null)) && ((bool) || ((paramq.c(i.a) != null) && (paramq.c(i.b) != null)));
  }
  
  public static boolean c(a.c.q paramq)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    if (!bool2) {
      if (!b(paramq)) {
        return true;
      }
    }
    k localk1 = paramq.c(i.a);
    k localk2 = paramq.c(i.b);
    HashSet localHashSet = new HashSet();
    w localw = paramq.v();
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        localHashSet.add(localk2.get(localw.d()));
        if (bool1) {
          break label143;
        }
        if (localHashSet.contains(localk1.get(localw.d()))) {
          return false;
        }
        localw.f();
      } while (!bool1);
    } while (bool2);
    localw = paramq.v();
    label143:
    do
    {
      while (!bool1)
      {
        if (!localw.e()) {
          break;
        }
        if (bool1) {
          break label193;
        }
        if (localHashSet.contains(localk1.get(localw.d()))) {
          return false;
        }
        localw.f();
      }
    } while (bool2);
    label193:
    return true;
  }
  
  z i(e parame)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    z localz = new z();
    do
    {
      for (e locale = b(parame); !bool1; locale = b(locale))
      {
        if (locale == null) {
          break;
        }
        if (bool1) {
          break label56;
        }
        localz.add(locale);
      }
    } while (bool2);
    label56:
    return localz;
  }
  
  public e b(e parame1, e parame2)
  {
    boolean bool2 = j;
    boolean bool1 = i;
    if (!bool2) {
      if (parame1 == parame2) {
        return b(parame1);
      }
    }
    if ((bool2) || (parame1 != null))
    {
      if (bool2) {
        break label47;
      }
      if (parame2 != null) {}
    }
    else
    {
      return null;
    }
    label47:
    int[] arrayOfInt = new int[parame1.g().j()];
    z localz1 = i(parame1);
    z localz2 = i(parame2);
    arrayOfInt[parame1.f()] += 1;
    y localy = localz1.h();
    Object localObject;
    e locale;
    do
    {
      do
      {
        if (!localy.e()) {
          break;
        }
        localObject = localy.j();
        locale = null;
        if (bool1) {
          break label176;
        }
        if ((localObject instanceof e)) {
          locale = (e)localObject;
        }
        if (locale != null) {
          arrayOfInt[locale.f()] += 1;
        }
        localy.f();
      } while (!bool1);
    } while (bool2);
    localy = localz2.h();
    label176:
    if (localy.e()) {}
    label243:
    while (bool2)
    {
      localObject = localy.j();
      locale = null;
      if ((bool2) || ((localObject instanceof e))) {
        locale = (e)localObject;
      }
      if (locale != null)
      {
        if (bool2) {
          break label243;
        }
        if (arrayOfInt[locale.f()] > 0) {
          return locale;
        }
      }
      localy.f();
      if (!bool1) {
        break;
      }
    }
    return d();
  }
  
  static final class a_
  {
    e a;
    bb b;
    ab c;
    ab d;
    
    a_(e parame, bb parambb)
    {
      this.a = parame;
      this.b = parambb;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.c.h

 * JD-Core Version:    0.7.0.1

 */